import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/department_regional_organization_tree/regional_organization_tree_view.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/data/entities/common/department_user_tree_entity.dart';
import 'package:enterprise_v6_app/app/modules/application/double_prevention_page/danger_investigation_page/task_allocation_hazard_investigation/task_allocation_allocated/department_user_tree/department_user_tree_controller.dart';
///部门选择
class DepartmentUserTreePage extends StatelessWidget {
  DepartmentUserTreePage({super.key});
  final controller = Get.put(DepartmentUserTreeController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        titleText: '部门选择',
      ),
      body: GetBuilder(
          init: controller,
          builder: (_) {
            return Container(
                padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 10.w, bottom: 80.w),
                alignment: Alignment.topCenter,
                color: const Color(0xffF5F5F6),
                child: Column(
                  children: [
                    DepartmentRegionalOrganizationTreePage(
                      selectedEntity: controller.selectedEntity,
                      onCallBack: (DepartmentUserTreeEntity entity) {
                        controller.selectedEntity = entity;
                      },
                    ),
                  ],
                ));
          }),
      bottomSheet: Container(
        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 5.w),
        decoration: BoxDecoration(
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color(0xffBCBCC5).withOpacity(0.3), // 阴影颜色
              offset: const Offset(0, -5), // 阴影的偏移量，向上偏移，即上方阴影
              blurRadius: 10.0, // 阴影的模糊半径
              spreadRadius: 2.0, // 阴影的扩散半径
            ),
          ],
        ),
        child: Row(
          children: [
            Expanded(
              child: ElevatedButton(
                style: ElevatedButton.styleFrom(
                  backgroundColor: AppColors.blue_button,
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(22.r),
                  ),
                ),
                onPressed: controller.complete,
                child: Text(
                  '确定',
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: Colors.white,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
